Integrand size = 29, antiderivative size = 90 \[ \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{a+b \sec (c+d x)} \, dx=-\frac {(A b-a B) x}{a^2}+\frac {2 b (A b-a B) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 \sqrt {a-b} \sqrt {a+b} d}+\frac {A \sin (c+d x)}{a d} \]
-(A*b-B*a)*x/a^2+A*sin(d*x+c)/a/d+2*b*(A*b-B*a)*arctanh((a-b)^(1/2)*tan(1/ 2*d*x+1/2*c)/(a+b)^(1/2))/a^2/d/(a-b)^(1/2)/(a+b)^(1/2)
Time = 0.68 (sec) , antiderivative size = 85, normalized size of antiderivative = 0.94 \[ \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{a+b \sec (c+d x)} \, dx=\frac {(-A b+a B) (c+d x)-\frac {2 b (A b-a B) \text {arctanh}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}+a A \sin (c+d x)}{a^2 d} \]
((-(A*b) + a*B)*(c + d*x) - (2*b*(A*b - a*B)*ArcTanh[((-a + b)*Tan[(c + d* x)/2])/Sqrt[a^2 - b^2]])/Sqrt[a^2 - b^2] + a*A*Sin[c + d*x])/(a^2*d)
Time = 0.45 (sec) , antiderivative size = 87, normalized size of antiderivative = 0.97, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.276, Rules used = {3042, 4522, 27, 3042, 4270, 3042, 3138, 221}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{a+b \sec (c+d x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {A+B \csc \left (c+d x+\frac {\pi }{2}\right )}{\csc \left (c+d x+\frac {\pi }{2}\right ) \left (a+b \csc \left (c+d x+\frac {\pi }{2}\right )\right )}dx\) |
\(\Big \downarrow \) 4522 |
\(\displaystyle \frac {A \sin (c+d x)}{a d}-\frac {\int \frac {A b-a B}{a+b \sec (c+d x)}dx}{a}\) |
\(\Big \downarrow \) 27 |
\(\displaystyle \frac {A \sin (c+d x)}{a d}-\frac {(A b-a B) \int \frac {1}{a+b \sec (c+d x)}dx}{a}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {A \sin (c+d x)}{a d}-\frac {(A b-a B) \int \frac {1}{a+b \csc \left (c+d x+\frac {\pi }{2}\right )}dx}{a}\) |
\(\Big \downarrow \) 4270 |
\(\displaystyle \frac {A \sin (c+d x)}{a d}-\frac {(A b-a B) \left (\frac {x}{a}-\frac {\int \frac {1}{\frac {a \cos (c+d x)}{b}+1}dx}{a}\right )}{a}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {A \sin (c+d x)}{a d}-\frac {(A b-a B) \left (\frac {x}{a}-\frac {\int \frac {1}{\frac {a \sin \left (c+d x+\frac {\pi }{2}\right )}{b}+1}dx}{a}\right )}{a}\) |
\(\Big \downarrow \) 3138 |
\(\displaystyle \frac {A \sin (c+d x)}{a d}-\frac {(A b-a B) \left (\frac {x}{a}-\frac {2 \int \frac {1}{\left (1-\frac {a}{b}\right ) \tan ^2\left (\frac {1}{2} (c+d x)\right )+\frac {a+b}{b}}d\tan \left (\frac {1}{2} (c+d x)\right )}{a d}\right )}{a}\) |
\(\Big \downarrow \) 221 |
\(\displaystyle \frac {A \sin (c+d x)}{a d}-\frac {(A b-a B) \left (\frac {x}{a}-\frac {2 b \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a d \sqrt {a-b} \sqrt {a+b}}\right )}{a}\) |
-(((A*b - a*B)*(x/a - (2*b*ArcTanh[(Sqrt[a - b]*Tan[(c + d*x)/2])/Sqrt[a + b]])/(a*Sqrt[a - b]*Sqrt[a + b]*d)))/a) + (A*Sin[c + d*x])/(a*d)
3.4.16.3.1 Defintions of rubi rules used
Int[(a_)*(Fx_), x_Symbol] :> Simp[a Int[Fx, x], x] /; FreeQ[a, x] && !Ma tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x /Rt[-a/b, 2]], x] /; FreeQ[{a, b}, x] && NegQ[a/b]
Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{ e = FreeFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d) Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 - b^2, 0]
Int[(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^(-1), x_Symbol] :> Simp[x/a, x] - Simp[1/a Int[1/(1 + (a/b)*Sin[c + d*x]), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 - b^2, 0]
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + ( a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[A*Cot[e + f*x]*(a + b*Csc[e + f*x])^(m + 1)*((d*Csc[e + f*x])^n/(a*f*n)), x] + Sim p[1/(a*d*n) Int[(a + b*Csc[e + f*x])^m*(d*Csc[e + f*x])^(n + 1)*Simp[a*B* n - A*b*(m + n + 1) + A*a*(n + 1)*Csc[e + f*x] + A*b*(m + n + 2)*Csc[e + f* x]^2, x], x], x] /; FreeQ[{a, b, d, e, f, A, B, m}, x] && NeQ[A*b - a*B, 0] && NeQ[a^2 - b^2, 0] && LeQ[n, -1]
Time = 1.06 (sec) , antiderivative size = 111, normalized size of antiderivative = 1.23
method | result | size |
derivativedivides | \(\frac {-\frac {2 \left (-\frac {A a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}+\left (A b -B a \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )\right )}{a^{2}}+\frac {2 b \left (A b -B a \right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a^{2} \sqrt {\left (a -b \right ) \left (a +b \right )}}}{d}\) | \(111\) |
default | \(\frac {-\frac {2 \left (-\frac {A a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}+\left (A b -B a \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )\right )}{a^{2}}+\frac {2 b \left (A b -B a \right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a^{2} \sqrt {\left (a -b \right ) \left (a +b \right )}}}{d}\) | \(111\) |
risch | \(-\frac {x A b}{a^{2}}+\frac {x B}{a}-\frac {i A \,{\mathrm e}^{i \left (d x +c \right )}}{2 a d}+\frac {i A \,{\mathrm e}^{-i \left (d x +c \right )}}{2 a d}+\frac {b^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right ) A}{\sqrt {a^{2}-b^{2}}\, d \,a^{2}}-\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right ) B}{\sqrt {a^{2}-b^{2}}\, d a}-\frac {b^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right ) A}{\sqrt {a^{2}-b^{2}}\, d \,a^{2}}+\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right ) B}{\sqrt {a^{2}-b^{2}}\, d a}\) | \(348\) |
1/d*(-2/a^2*(-A*a*tan(1/2*d*x+1/2*c)/(1+tan(1/2*d*x+1/2*c)^2)+(A*b-B*a)*ar ctan(tan(1/2*d*x+1/2*c)))+2*b*(A*b-B*a)/a^2/((a-b)*(a+b))^(1/2)*arctanh((a -b)*tan(1/2*d*x+1/2*c)/((a-b)*(a+b))^(1/2)))
Time = 0.30 (sec) , antiderivative size = 328, normalized size of antiderivative = 3.64 \[ \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{a+b \sec (c+d x)} \, dx=\left [\frac {2 \, {\left (B a^{3} - A a^{2} b - B a b^{2} + A b^{3}\right )} d x - {\left (B a b - A b^{2}\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) + 2 \, {\left (A a^{3} - A a b^{2}\right )} \sin \left (d x + c\right )}{2 \, {\left (a^{4} - a^{2} b^{2}\right )} d}, \frac {{\left (B a^{3} - A a^{2} b - B a b^{2} + A b^{3}\right )} d x - {\left (B a b - A b^{2}\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) + {\left (A a^{3} - A a b^{2}\right )} \sin \left (d x + c\right )}{{\left (a^{4} - a^{2} b^{2}\right )} d}\right ] \]
[1/2*(2*(B*a^3 - A*a^2*b - B*a*b^2 + A*b^3)*d*x - (B*a*b - A*b^2)*sqrt(a^2 - b^2)*log((2*a*b*cos(d*x + c) - (a^2 - 2*b^2)*cos(d*x + c)^2 + 2*sqrt(a^ 2 - b^2)*(b*cos(d*x + c) + a)*sin(d*x + c) + 2*a^2 - b^2)/(a^2*cos(d*x + c )^2 + 2*a*b*cos(d*x + c) + b^2)) + 2*(A*a^3 - A*a*b^2)*sin(d*x + c))/((a^4 - a^2*b^2)*d), ((B*a^3 - A*a^2*b - B*a*b^2 + A*b^3)*d*x - (B*a*b - A*b^2) *sqrt(-a^2 + b^2)*arctan(-sqrt(-a^2 + b^2)*(b*cos(d*x + c) + a)/((a^2 - b^ 2)*sin(d*x + c))) + (A*a^3 - A*a*b^2)*sin(d*x + c))/((a^4 - a^2*b^2)*d)]
\[ \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{a+b \sec (c+d x)} \, dx=\int \frac {\left (A + B \sec {\left (c + d x \right )}\right ) \cos {\left (c + d x \right )}}{a + b \sec {\left (c + d x \right )}}\, dx \]
Exception generated. \[ \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{a+b \sec (c+d x)} \, dx=\text {Exception raised: ValueError} \]
Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(4*a^2-4*b^2>0)', see `assume?` f or more de
Time = 0.32 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.57 \[ \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{a+b \sec (c+d x)} \, dx=\frac {\frac {{\left (B a - A b\right )} {\left (d x + c\right )}}{a^{2}} + \frac {2 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )} a} - \frac {2 \, {\left (B a b - A b^{2}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{\sqrt {-a^{2} + b^{2}} a^{2}}}{d} \]
((B*a - A*b)*(d*x + c)/a^2 + 2*A*tan(1/2*d*x + 1/2*c)/((tan(1/2*d*x + 1/2* c)^2 + 1)*a) - 2*(B*a*b - A*b^2)*(pi*floor(1/2*(d*x + c)/pi + 1/2)*sgn(-2* a + 2*b) + arctan(-(a*tan(1/2*d*x + 1/2*c) - b*tan(1/2*d*x + 1/2*c))/sqrt( -a^2 + b^2)))/(sqrt(-a^2 + b^2)*a^2))/d
Time = 15.99 (sec) , antiderivative size = 740, normalized size of antiderivative = 8.22 \[ \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{a+b \sec (c+d x)} \, dx=\frac {2\,A\,b^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,\left (a^4-a^2\,b^2\right )}+\frac {2\,B\,a^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,\left (a^4-a^2\,b^2\right )}+\frac {A\,a^3\,\sin \left (c+d\,x\right )}{d\,\left (a^4-a^2\,b^2\right )}-\frac {A\,a\,b^2\,\sin \left (c+d\,x\right )}{d\,\left (a^4-a^2\,b^2\right )}+\frac {A\,b^2\,\mathrm {atan}\left (\frac {-a^5\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,1{}\mathrm {i}+b^3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,{\left (a^2-b^2\right )}^{3/2}\,2{}\mathrm {i}+b^5\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,2{}\mathrm {i}-a^2\,b^3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,3{}\mathrm {i}+a^3\,b^2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,1{}\mathrm {i}+a^4\,b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^6-2\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^4\,b^2+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2\,b^4}\right )\,\sqrt {a^2-b^2}\,2{}\mathrm {i}}{d\,\left (a^4-a^2\,b^2\right )}-\frac {2\,A\,a^2\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,\left (a^4-a^2\,b^2\right )}-\frac {2\,B\,a\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,\left (a^4-a^2\,b^2\right )}-\frac {B\,a\,b\,\mathrm {atan}\left (\frac {-a^5\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,1{}\mathrm {i}+b^3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,{\left (a^2-b^2\right )}^{3/2}\,2{}\mathrm {i}+b^5\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,2{}\mathrm {i}-a^2\,b^3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,3{}\mathrm {i}+a^3\,b^2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,1{}\mathrm {i}+a^4\,b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^6-2\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^4\,b^2+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2\,b^4}\right )\,\sqrt {a^2-b^2}\,2{}\mathrm {i}}{d\,\left (a^4-a^2\,b^2\right )} \]
(2*A*b^3*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/(d*(a^4 - a^2*b^2)) + (2*B*a^3*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/(d*(a^4 - a^2*b^2) ) + (A*a^3*sin(c + d*x))/(d*(a^4 - a^2*b^2)) - (A*a*b^2*sin(c + d*x))/(d*( a^4 - a^2*b^2)) + (A*b^2*atan((b^3*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(3/2)*2i - a^5*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*1i + b^5*sin(c/2 + (d*x)/2)*(a ^2 - b^2)^(1/2)*2i - a^2*b^3*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*3i + a^3 *b^2*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*1i + a^4*b*sin(c/2 + (d*x)/2)*(a ^2 - b^2)^(1/2)*1i)/(a^6*cos(c/2 + (d*x)/2) + a^2*b^4*cos(c/2 + (d*x)/2) - 2*a^4*b^2*cos(c/2 + (d*x)/2)))*(a^2 - b^2)^(1/2)*2i)/(d*(a^4 - a^2*b^2)) - (2*A*a^2*b*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/(d*(a^4 - a^2*b^ 2)) - (2*B*a*b^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/(d*(a^4 - a^ 2*b^2)) - (B*a*b*atan((b^3*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(3/2)*2i - a^5*s in(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*1i + b^5*sin(c/2 + (d*x)/2)*(a^2 - b^2 )^(1/2)*2i - a^2*b^3*sin(c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*3i + a^3*b^2*sin (c/2 + (d*x)/2)*(a^2 - b^2)^(1/2)*1i + a^4*b*sin(c/2 + (d*x)/2)*(a^2 - b^2 )^(1/2)*1i)/(a^6*cos(c/2 + (d*x)/2) + a^2*b^4*cos(c/2 + (d*x)/2) - 2*a^4*b ^2*cos(c/2 + (d*x)/2)))*(a^2 - b^2)^(1/2)*2i)/(d*(a^4 - a^2*b^2))